
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>后台开发框架</title>
    <link rel="stylesheet" href="/assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="/assets/module/admin.css?v=315"/>
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        /** 统计快捷方式样式 */
        .console-link-block {
            display: block;
            position: relative;
            color: #fff;
            font-size: 18px;
            padding: 25px 20px;
            border-radius: 4px;
            overflow: hidden;
            box-shadow: 0px 3px 5px rgba(0, 0, 0, .1);
            background-color: rgb(155, 197, 57);
        }

        .console-link-block .console-link-block-num {
            font-size: 32px;
            font-weight: bold;
            margin-bottom: 10px;
        }

        .console-link-block .console-link-block-icon {
            height: 70px;
            position: absolute;
            right: 20px;
            top: 50%;
            transform: translateY(-50%);
        }

        .console-link-block .console-link-block-band {
            background-color: rgb(227, 42, 22);
            font-size: 14px;
            position: absolute;
            width: 80px;
            padding: 0px 0;
            text-align: center;
            transform: rotate(45deg);
            right: -21px;
            top: 8px;
            color: rgba(255, 255, 255, .9);
            z-index: 1;
        }

        /** //统计快捷方式样式end */

        /** 小屏幕下样式 */
        @media screen and (max-width: 992px) {
            .console-link-block {
                font-size: 14px;
                padding: 15px 10px;
            }

            .console-link-block .console-link-block-num {
                font-size: 22px;
                margin-bottom: 0px;
            }

            .console-link-block .console-link-block-icon {
                height: 45px;
                right: 10px;
            }

            .console-link-block .console-link-block-band {
                font-size: 12px;
                right: -25px;
                top: 8px;
            }

        }

        /** 设置每个快捷块的颜色 */
        #consoleLink > div:first-child .console-link-block {
            background-color: rgb(155, 197, 57);
        }

        #consoleLink > div:nth-child(2) .console-link-block {
            background-color: rgb(85, 165, 234);
        }

        #consoleLink > div:nth-child(3) .console-link-block {
            background-color: rgb(157, 175, 291);
        }

        #consoleLink > div:nth-child(4) .console-link-block {
            background-color: rgb(245, 145, 162);
        }

        #consoleLink > div:nth-child(5) .console-link-block {
            background-color: rgb(254, 170, 79);
        }

        #consoleLink > div:last-child .console-link-block {
            background-color: rgb(64, 212, 176);
        }

        /** //设置每个快捷块的颜色end */
    </style>
</head>

<body>

<!-- 正文开始 -->
<div class="layui-fluid">
    <!-- 快捷方式 -->
    <div id="consoleLink" class="layui-row layui-col-space15">

 {foreach $list as $key=>$vo}
        <div class="layui-col-lg2 layui-col-md4 layui-col-sm4 layui-col-xs6">
            <div class="console-link-block" ew-href="{:url('index/addappointment')}?visitdate={$vo['visitdate']}" ew-title="预约申请">
                <div class="console-link-block-num">{$vo['c']}/{$maxNum}</div>
                <div class="console-link-block-text">预约{$vo['visitdate']|format_datetime='m-d'}参观</div>
                <div class="console-link-block-band">去预约</div>
            </div>
        </div>
{/foreach}



    </div>
    <!-- 统计图表 -->
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md6 layui-col-sm6 layui-col-xs12">
            <div class="layui-card">
                <div class="layui-card-header">今天的预约统计</div>
                <div class="layui-card-body">
                    <div style="height: 300px;position: relative;">
                        <div id="tjDivDay" style="height: 100%;"></div>
                        
                        <span id="btnShowDetail_1"
                              style="color: #1AB4E8;font-size: 18px;position: absolute;bottom: 75px;left: 50%;transform: translateX(-50%);cursor: pointer;">
                     <a ew-href="{:url('index/addappointment')}">预约申请<i class="layui-icon layui-icon-right" style="font-size: 16px;"></i></a>
                        </span>
                        
                    </div>
                    <div class="layui-row text-center">
                        <div class="layui-col-xs6">
                            <div id="tv1Num1" style="color: #28a6d6;font-size: 22px;">{$data1}</div>
                            <div style="font-size: 18px;padding: 10px 0 15px 0;">已预约</div>
                        </div>
                        <div class="layui-col-xs6">
                            <div id="tv1Num2" style="color: #28a6d6;font-size: 22px;">{$undata1}</div>
                            <div style="font-size: 18px;padding: 10px 0 15px 0;">未预约</div>
                        </div>
                    </div>
                </div>
            </div>
        </div>



        <div class="layui-col-md6 layui-col-sm6 layui-col-xs12">
            <div class="layui-card">
                <div class="layui-card-header">今天的预约分布</div>
                <div class="layui-card-body">
                    <div id="tjDivWeek" style="height: 373px;"></div>
                </div>
            </div>
        </div>










    </div>















</div>

<!-- 加载动画 -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>

<!-- js部分 -->
<script type="text/javascript" src="/assets/libs/layui/layui.js"></script>
<script type="text/javascript" src="/assets/js/common.js?v=315"></script>
<script src="/assets/libs/echarts/echarts.min.js"></script>
<script src="/assets/libs/echarts/echartsTheme.js"></script>
<script>
    layui.use(['layer', 'table', 'admin'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var table = layui.table;
        var admin = layui.admin;

        // 渲染日签到图表
        var myCharts1 = echarts.init(document.getElementById('tjDivDay'), myEchartsTheme);
        var options1 = {
            title: {
                show: true,
                x: 'center',
                y: '33%',
                text: '预约人数/总人数',
                textStyle: {
                    fontSize: 20,
                    color: '#333'
                },
                subtextStyle: {
                    fontSize: 50,
                    lineHeight: 100,
                    color: '#28a6d6'
                }
            },
            color: ['#18B4E7', '#ddd'],
            tooltip: {
                trigger: 'item'
            },
            series: [
                {
                    name: '人数',
                    type: 'pie',
                    radius: ['75%', '80%'],
                    label: {
                        normal: {
                            show: false
                        }
                    }
                }
            ]
        };
        myCharts1.setOption(options1);
        // 搜索
        var res1 = JSON.parse('{"msg":"操作成功","signNum":38,"signList":[{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"},{"number":"12","name":"用户一","time":"05:30"}],"code":200,"allNum":60}');
        var mSignList = res1.signList;

        var allNum = {$maxNum};
        var signNum ={$data1};
        myCharts1.setOption({
            title: {
                subtext: signNum  + "/" + allNum
                //subtext: res1.signNum + "/" + res1.allNum
            },
            series: [
                {
                    data: [
                        {name: "已预约", value:  signNum },
                        {name: "可预约", value: allNum - signNum}
                    ]
                }
            ]
        });
        // 签到明细
        $('#btnShowDetail').click(function () {
            admin.open({
                type: 1,
                area: '500px',
                offset: '80px',
                title: '签到明细',
                content: '<table id="signDetailTable" lay-filter="signDetailTable"></table>',
                success: function (layero, dIndex) {
                    // 渲染表格
                    table.render({
                        elem: '#signDetailTable',
                        data: mSignList,
                        page: false,
                        height: 280,
                        cellMinWidth: 100,
                        cols: [[
                            {type: 'numbers', title: '#'},
                            {field: 'number', title: '工号'},
                            {field: 'name', title: '姓名'},
                            {field: 'time', title: '签到时间'},
                        ]],
                        done: function () {
                            $(layero).find('.layui-table-view').css('margin', '0');
                        }
                    });
                    // end
                }
            });
        });

       
        var myCharts2 = echarts.init(document.getElementById('tjDivWeek'), myEchartsTheme);
        //var myChart = echarts.init(dom);
        
        var option = null;
        option = {
            tooltip: {
                trigger: 'item',
                formatter: '{a} <br/>{b}: {c} ({d}%)'
            },
            legend: {
                orient: 'vertical',
                left: 40,
                data: ['上午', '下午']
            },
            series: [
                {
                    name: '预约分布',
                    type: 'pie',
                    selectedMode: 'single',
                    radius: [0, '10%'],

                    label: {
                        position: 'inner'
                    },
                    labelLine: {
                        show: true
                    },
                    data: [
                    ]
                },
                {
                    name: '预约分布',
                    type: 'pie',
                    radius: ['30%', '40%'],
                    label: {
                        formatter: '{a|{a}}{abg|}\n{hr|}\n  {b|{b}：}{c}  {per|{d}%}  ',
                        backgroundColor: '#eee',
                        borderColor: '#aaa',
                        borderWidth: 1,
                        borderRadius: 4,
                        // shadowBlur:3,
                        // shadowOffsetX: 12,
                        // shadowOffsetY: 12,
                        // shadowColor: '#999',
                        // padding: [0, 7],
                        rich: {
                            a: {
                                color: '#777',
                                lineHeight: 22,
                                align: 'center'
                            },
                             //abg: {
                             //    backgroundColor: '#555',
                             //    width: '100%',
                             //    align: 'right',
                             //    height: 22,
                             //    borderRadius: [4, 4, 0, 0]
                             //},
                            hr: {
                                borderColor: '#aaa',
                                width: '100%',
                                borderWidth: 0.5,
                                height: 0
                            },
                            b: {
                                fontSize: 16,
                                lineHeight: 33
                            },
                            per: {
                                color: '#eee',
                                backgroundColor: '#334455',
                                padding: [2, 4],
                                borderRadius: 2
                            }
                        }
                    },
                    data: [
                        {value: {$morning}, name: '上午'},
                        {value: {$afternoon}, name: '下午'},
                    ]
                }
            ]
        };
        myCharts2.setOption(option, true);




        // 窗口大小改变事件
        window.onresize = function () {
            myCharts1.resize();
            myCharts2.resize();
            //myCharts3.resize();
        };

    });
</script>
</body>

</html>